import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

export default new VueRouter({
  mode: 'hash',
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition;
    } else {
      return {
        x: 0,
        y: 0
      };
    }
  },
  routes: [
    {
      path: '/',
      component: () => import('@/layouts/common-layout'),
      children: [
        {
          path: '/',
          meta: {
            title: '综合态势'
          },
          component: () => import('@/pages/index')
        }, {
          path: '/driving',
          meta: {
            title: '行车运行态势'
          },
          component: () => import('@/pages/driving')
        }, {
          path: '/trolley',
          meta: {
            title: '台车运行态势'
          },
          component: () => import('@/pages/trolley')
        }
      ]
    }
  ]
})